﻿@{
    //  ViewBag.SameBrand
    FashionShop.Models.Product p = ViewBag.product;
    List<FashionShop.Models.Product> SameCatalogueProducts = ViewBag.SameCatalogue;
    List<FashionShop.Models.Product> SameBrandProducts = ViewBag.SameBrand;
    ViewBag.Title = p.Name;
}
<div class="kn-left" style="width:100%">
    <div class="kn-special" style="margin-top: 5px;">
            <div class="kn-panel">Cùng loại</div>
            @foreach(var cp in SameCatalogueProducts){
                string img = "/Content/img/product/" + cp.ProductID.ToString() + ".jpg"; 
            <div class="product-box">
                <a href="/san-pham/@cp.ProductID/@cp.URL"><img src="@img"></a>
                <a href="/san-pham/@cp.ProductID/@cp.URL"><b>@cp.Name</b></a>
               
                <h4 class="price">
                     @if(cp.Price > cp.SalePrice){
                        <del>@cp.Price.ToString("N0");</del> 
                        <b>@cp.SalePrice.ToString("N0")</b> <span>đ</span> 
                     }else{
                         <b>@cp.SalePrice.ToString("N0")</b> <span>đ</span> 
                     }
                </h4>
            </div>
            }
    </div>

    <div class="kn-special" style="margin-top: 5px;">
            <div class="kn-panel">Cùng thương hiệu</div>
            @foreach (var cp in SameBrandProducts){
                string img = "/Content/img/product/" + cp.ProductID.ToString() + ".jpg"; 
            <div class="product-box">
                <a href="/san-pham/@cp.ProductID/@cp.URL"><img src="@img"></a>
                <a href="/san-pham/@cp.ProductID/@cp.URL"><b>@cp.Name</b></a>
               
                <h4 class="price">
                     @if(cp.Price > cp.SalePrice){
                        <del>@cp.Price.ToString("N0");</del> 
                        <b>@cp.SalePrice.ToString("N0")</b> <span>đ</span> 
                     }else{
                         <b>@cp.SalePrice.ToString("N0")</b> <span>đ</span> 
                     }
                </h4>
            </div>
            }
    </div>
</div>
<div class="kn-main" style="width:70%;">
    <div class="product-single">
        @{string image = "/Content/img/product/" + p.ProductID.ToString() + ".jpg";}
        <a id="product-image" href="@image"><img src="@image" /></a>
        <h1 class="product-title">@p.Name</h1>
        <div class="product-brand">Hãng sản xuất: <a href="/thuong-hieu/@p.Brand.URL"><b>@p.Brand.Name</b></a></div>
        <div class="product-price">
            @if(p.SalePrice < p.Price){
                <del>@p.Price.ToString("N0")</del>@p.SalePrice.ToString("N0") <span>đ</span>
            }else{
                @p.SalePrice.ToString("N0") <span>đ</span>
            }
        </div>
        <a href="@Url.Action("AddToCart", new { controller = "Customer", id = p.ProductID})" class="btn btn-success"><span class="glyphicon glyphicon-shopping-cart"></span>Add to cart</a>
         
        <div class="product-description">
            @p.Description
        </div>
        <div class="fb-comments" data-href="@Request.Url.AbsoluteUri" data-numposts="5" data-colorscheme="light"></div>
        
    </div>

   @if (Session["Username"] != null){
        <a target="_blank" class="btn btn-xs btn-info" href="@Url.Action("Edit", new {area = "Admin", controller = "Product", action = "Edit", id=p.ProductID})">
            <span class="glyphicon glyphicon-edit"></span>
            Edit</a>
   }
</div>